package qky.common.utils;

import java.util.HashMap;
import java.util.Map;

public class MapParamBuilder<K, V> {

    private Map<K, V> map;

    public MapParamBuilder(int initSize) {
        this.map = new HashMap<>(initSize);
    }

    public MapParamBuilder() {
        this.map = new HashMap<>(5);
    }

    public MapParamBuilder<K, V> param(K k, V v){
        this.map.put(k, v);
        return this;
    }

    /** 清理：map.clear() */
    public MapParamBuilder<K, V> clear(){
        this.map.clear();
        return this;
    }

    /** 清理：设置为null */
    public void clean(){
        this.map = null;
    }

    public Map<K, V> get(){
        return this.map;
    }
}
